//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/.
// 			VisualNovelToolkit		     /_/_/_/_/_/_/_/_/_/.
// Copyright ©2013 - Sol-tribe.	/_/_/_/_/_/_/_/_/_/.
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Xml.Serialization;

/// <summary>
/// Play Scenario node.
/// It is expected that the Played ScenarioNode exists in your Scene.
/// </summary>
[ System.Serializable]
//[AddComponentMenu("ViNo/Nodes/PlayScenario")]
public class PlayScenarioNode : ViNode {
	public ScenarioNode scenario;	// Played Another ScenarioNode Object.

	void Start(){
		NotEditable();		
	}

	// TODO.
	public override void ToScenarioScript( ref System.Text.StringBuilder sb ){
		sb.Append( "[jump storage=" + scenario.name + "target=*START]" );
		sb.Append( System.Environment.NewLine );
	}
	
	public override void ToByteCode( ByteCodes code  ){
		List<byte> byteList  = new List<byte>();		

		byteList.Add( Opcode.PLAY_SCENARIO );
		ByteCodeScriptTools.AddStringCode( byteList , scenario.name );		

		code.Add( byteList.ToArray() );

		// Compile Internal.
		ToByteCodeInternal( code );		
	}
}

